--------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Volumes/rdss_meghrogers/Current Research/Markets-Pridemore/Work/MA
> R01-DataClean-UNODC.log
  log type:  text
 opened on:   5 May 2025, 13:50:12

. 
. //  program:    Stata 
. //  task:       Merging Data Together and Cleaning  
. //  project:    Market
. 
. version
version 18.5

. clear all

. macro drop _all

. set linesize 80

. set more off

. local tag "05-05-25 "

. local file "MAR01-DataClean-UNODC"

. local note "|`tag' | `file'"

. 
. 
. //      #0
. //      Loading Data
. insheet using 00-Pridemore-Foundation-05-31-23.csv, comma clear n
(5 vars, 3,480 obs)

. rename Nation nation

. 
. gen CID=. 
(3,480 missing values generated)

. do 000-CID-nation.do

. replace CID=    4       if nation=="Afghanistan"
(0 real changes made)

. replace CID=    248     if nation=="Aland Islands"
(0 real changes made)

. replace CID=    8       if nation=="Albania"
(21 real changes made)

. replace CID=    12      if nation=="Algeria"
(21 real changes made)

. replace CID=    16      if nation=="American Samoa"
(0 real changes made)

. replace CID=    20      if nation=="Andorra"
(0 real changes made)

. replace CID=    24      if nation=="Angola"
(21 real changes made)

. replace CID=    660     if nation=="Anguilla"
(0 real changes made)

. replace CID=    10      if nation=="Antarctica"
(0 real changes made)

. replace CID=    28      if nation=="Antigua and Barbuda"
(0 real changes made)

. replace CID=    32      if nation=="Argentina"
(21 real changes made)

. replace CID=    51      if nation=="Armenia"
(21 real changes made)

. replace CID=    533     if nation=="Aruba"
(0 real changes made)

. replace CID=    36      if nation=="Australia"
(21 real changes made)

. replace CID=    40      if nation=="Austria"
(21 real changes made)

. replace CID=    31      if nation=="Azerbaijan"
(21 real changes made)

. replace CID=    44      if nation=="Bahamas"
(0 real changes made)

. replace CID=    44      if nation=="Bahamas, The"
(21 real changes made)

. replace CID=    48      if nation=="Bahrain"
(21 real changes made)

. replace CID=    50      if nation=="Bangladesh"
(21 real changes made)

. replace CID=    52      if nation=="Barbados"
(21 real changes made)

. replace CID=    112     if nation=="Belarus"
(21 real changes made)

. replace CID=    56      if nation=="Belgium"
(21 real changes made)

. replace CID=    84      if nation=="Belize"
(21 real changes made)

. replace CID=    204     if nation=="Benin"
(21 real changes made)

. replace CID=    60      if nation=="Bermuda"
(0 real changes made)

. replace CID=    64      if nation=="Bhutan"
(21 real changes made)

. replace CID=    68      if nation=="Bolivia"
(21 real changes made)

. replace CID=    70      if nation=="Bosnia and Herzegovina"
(21 real changes made)

. replace CID=    72      if nation=="Botswana"
(21 real changes made)

. replace CID=    74      if nation=="Bouvet Island"
(0 real changes made)

. replace CID=    76      if nation=="Brazil"
(21 real changes made)

. replace CID=    86      if nation=="British Indian Ocean Territory"
(0 real changes made)

. replace CID=    92      if nation=="British Virgin Islands"
(0 real changes made)

. replace CID=    96      if nation=="Brunei Darussalam"
(21 real changes made)

. replace CID=    100     if nation=="Bulgaria"
(21 real changes made)

. replace CID=    854     if nation=="Burkina Faso"
(21 real changes made)

. replace CID=    108     if nation=="Burundi"
(21 real changes made)

. replace CID=    116     if nation=="Cambodia"
(21 real changes made)

. replace CID=    120     if nation=="Cameroon"
(21 real changes made)

. replace CID=    124     if nation=="Canada"
(21 real changes made)

. replace CID=    132     if nation=="Cabo Verde"
(21 real changes made)

. replace CID=    132     if nation=="Cape Verde"
(0 real changes made)

. replace CID=    136     if nation=="Cayman Islands"
(0 real changes made)

. replace CID=    140     if nation=="Central African Republic"
(21 real changes made)

. replace CID=    148     if nation=="Chad"
(21 real changes made)

. replace CID=    152     if nation=="Chile"
(21 real changes made)

. replace CID=    156     if nation=="China"
(21 real changes made)

. replace CID=    162     if nation=="Christmas Island"
(0 real changes made)

. replace CID=    166     if nation=="Cocos (Keeling) Islands"
(0 real changes made)

. replace CID=    170     if nation=="Colombia"
(21 real changes made)

. replace CID=    174     if nation=="Comoros"
(21 real changes made)

. replace CID=    178     if nation=="Congo (Brazzaville)"
(0 real changes made)

. replace CID=    178     if nation=="Congo, Rep."
(21 real changes made)

. replace CID=    180     if nation=="Congo, Democratic Republic of the"
(0 real changes made)

. replace CID=    180     if nation=="Congo, Dem. Rep."
(21 real changes made)

. replace CID=    184     if nation=="Cook Islands"
(0 real changes made)

. replace CID=    188     if nation=="Costa Rica"
(21 real changes made)

. replace CID=    191     if nation=="Croatia"
(21 real changes made)

. replace CID=    192     if nation=="Cuba"
(0 real changes made)

. replace CID=    196     if nation=="Cyprus"
(21 real changes made)

. replace CID=    203     if nation=="Czech Republic"
(21 real changes made)

. replace CID=    384     if nation=="Côte d'Ivoire"
(0 real changes made)

. replace CID=    384     if nation=="Cote d'Ivoire"
(21 real changes made)

. replace CID=    208     if nation=="Denmark"
(21 real changes made)

. replace CID=    262     if nation=="Djibouti"
(21 real changes made)

. replace CID=    212     if nation=="Dominica"
(0 real changes made)

. replace CID=    214     if nation=="Dominican Republic"
(21 real changes made)

. replace CID=    218     if nation=="Ecuador"
(21 real changes made)

. replace CID=    818     if nation=="Egypt"
(0 real changes made)

. replace CID=    818     if nation=="Egypt, Arab Rep."
(21 real changes made)

. replace CID=    222     if nation=="El Salvador"
(21 real changes made)

. replace CID=    226     if nation=="Equatorial Guinea"
(0 real changes made)

. replace CID=    232     if nation=="Eritrea"
(0 real changes made)

. replace CID=    233     if nation=="Estonia"
(21 real changes made)

. replace CID=    231     if nation=="Ethiopia"
(21 real changes made)

. replace CID=    238     if nation=="Falkland Islands (Malvinas)"
(0 real changes made)

. replace CID=    234     if nation=="Faroe Islands"
(0 real changes made)

. replace CID=    242     if nation=="Fiji"
(21 real changes made)

. replace CID=    246     if nation=="Finland"
(21 real changes made)

. replace CID=    250     if nation=="France"
(21 real changes made)

. replace CID=    254     if nation=="French Guiana"
(0 real changes made)

. replace CID=    258     if nation=="French Polynesia"
(0 real changes made)

. replace CID=    260     if nation=="French Southern Territories"
(0 real changes made)

. replace CID=    266     if nation=="Gabon"
(21 real changes made)

. replace CID=    270     if nation=="Gambia"
(0 real changes made)

. replace CID=    270     if nation=="Gambia, The"
(21 real changes made)

. replace CID=    268     if nation=="Georgia"
(21 real changes made)

. replace CID=    276     if nation=="Germany"
(21 real changes made)

. replace CID=    288     if nation=="Ghana"
(21 real changes made)

. replace CID=    292     if nation=="Gibraltar"
(0 real changes made)

. replace CID=    300     if nation=="Greece"
(21 real changes made)

. replace CID=    304     if nation=="Greenland"
(0 real changes made)

. replace CID=    308     if nation=="Grenada"
(0 real changes made)

. replace CID=    312     if nation=="Guadeloupe"
(0 real changes made)

. replace CID=    316     if nation=="Guam"
(0 real changes made)

. replace CID=    320     if nation=="Guatemala"
(21 real changes made)

. replace CID=    831     if nation=="Guernsey"
(0 real changes made)

. replace CID=    324     if nation=="Guinea"
(21 real changes made)

. replace CID=    624     if nation=="Guinea-Bissau"
(21 real changes made)

. replace CID=    328     if nation=="Guyana"
(21 real changes made)

. replace CID=    332     if nation=="Haiti"
(21 real changes made)

. replace CID=    334     if nation=="Heard Island and Mcdonald Islands"
(0 real changes made)

. replace CID=    336     if nation=="Holy See (Vatican City State)"
(0 real changes made)

. replace CID=    340     if nation=="Honduras"
(21 real changes made)

. replace CID=    344     if nation=="Hong Kong SAR"
(0 real changes made)

. replace CID=    344     if nation=="Hong Kong SAR, China"
(21 real changes made)

. replace CID=    348     if nation=="Hungary"
(21 real changes made)

. replace CID=    352     if nation=="Iceland"
(21 real changes made)

. replace CID=    356     if nation=="India"
(21 real changes made)

. replace CID=    360     if nation=="Indonesia"
(21 real changes made)

. replace CID=    364     if nation=="Iran (Islamic Republic of)"
(0 real changes made)

. replace CID=    364     if nation=="Iran, Islamic Rep."
(21 real changes made)

. replace CID=    368     if nation=="Iraq"
(21 real changes made)

. replace CID=    372     if nation=="Ireland"
(21 real changes made)

. replace CID=    833     if nation=="Isle of Man"
(0 real changes made)

. replace CID=    376     if nation=="Israel"
(21 real changes made)

. replace CID=    380     if nation=="Italy"
(21 real changes made)

. replace CID=    388     if nation=="Jamaica"
(21 real changes made)

. replace CID=    392     if nation=="Japan"
(21 real changes made)

. replace CID=    832     if nation=="Jersey"
(0 real changes made)

. replace CID=    400     if nation=="Jordan"
(21 real changes made)

. replace CID=    398     if nation=="Kazakhstan"
(21 real changes made)

. replace CID=    404     if nation=="Kenya"
(21 real changes made)

. replace CID=    296     if nation=="Kiribati"
(0 real changes made)

. replace CID=    408     if nation=="Korea, Democratic People's Republic of"
(0 real changes made)

. replace CID=    410     if nation=="Republic of Korea"
(0 real changes made)

. replace CID=    410     if nation=="Korea, Rep."
(21 real changes made)

. replace CID=    414     if nation=="Kuwait"
(21 real changes made)

. replace CID=    417     if nation=="Kyrgyzstan"
(0 real changes made)

. replace CID=    417     if nation=="Kyrgyz Republic"
(21 real changes made)

. replace CID=    418     if nation=="Lao PDR"
(21 real changes made)

. replace CID=    428     if nation=="Latvia"
(21 real changes made)

. replace CID=    422     if nation=="Lebanon"
(21 real changes made)

. replace CID=    426     if nation=="Lesotho"
(21 real changes made)

. replace CID=    430     if nation=="Liberia"
(21 real changes made)

. replace CID=    434     if nation=="Libya"
(21 real changes made)

. replace CID=    438     if nation=="Liechtenstein"
(0 real changes made)

. replace CID=    440     if nation=="Lithuania"
(21 real changes made)

. replace CID=    442     if nation=="Luxembourg"
(21 real changes made)

. replace CID=    446     if nation=="Macau"
(0 real changes made)

. replace CID=    807     if nation=="TFYR Macedonia"
(0 real changes made)

. replace CID=    807     if nation=="North Macedonia"
(21 real changes made)

. replace CID=    450     if nation=="Madagascar"
(21 real changes made)

. replace CID=    454     if nation=="Malawi"
(21 real changes made)

. replace CID=    458     if nation=="Malaysia"
(21 real changes made)

. replace CID=    462     if nation=="Maldives"
(0 real changes made)

. replace CID=    466     if nation=="Mali"
(21 real changes made)

. replace CID=    470     if nation=="Malta"
(21 real changes made)

. replace CID=    584     if nation=="Marshall Islands"
(0 real changes made)

. replace CID=    474     if nation=="Martinique"
(0 real changes made)

. replace CID=    478     if nation=="Mauritania"
(21 real changes made)

. replace CID=    480     if nation=="Mauritius"
(21 real changes made)

. replace CID=    175     if nation=="Mayotte"
(0 real changes made)

. replace CID=    484     if nation=="Mexico"
(21 real changes made)

. replace CID=    583     if nation=="Micronesia, Federated States of"
(0 real changes made)

. replace CID=    498     if nation=="Republic of Moldova"
(0 real changes made)

. replace CID=    498     if nation=="Moldova"
(21 real changes made)

. replace CID=    492     if nation=="Monaco"
(0 real changes made)

. replace CID=    496     if nation=="Mongolia"
(21 real changes made)

. replace CID=    499     if nation=="Montenegro"
(21 real changes made)

. replace CID=    500     if nation=="Montserrat"
(0 real changes made)

. replace CID=    504     if nation=="Morocco"
(21 real changes made)

. replace CID=    508     if nation=="Mozambique"
(21 real changes made)

. replace CID=    104     if nation=="Myanmar"
(21 real changes made)

. replace CID=    516     if nation=="Namibia"
(21 real changes made)

. replace CID=    520     if nation=="Nauru"
(0 real changes made)

. replace CID=    524     if nation=="Nepal"
(21 real changes made)

. replace CID=    528     if nation=="Netherlands"
(21 real changes made)

. replace CID=    530     if nation=="Netherlands Antilles"
(0 real changes made)

. replace CID=    540     if nation=="New Caledonia"
(0 real changes made)

. replace CID=    554     if nation=="New Zealand"
(21 real changes made)

. replace CID=    558     if nation=="Nicaragua"
(21 real changes made)

. replace CID=    562     if nation=="Niger"
(21 real changes made)

. replace CID=    566     if nation=="Nigeria"
(21 real changes made)

. replace CID=    570     if nation=="Niue"
(0 real changes made)

. replace CID=    574     if nation=="Norfolk Island"
(0 real changes made)

. replace CID=    580     if nation=="Northern Mariana Islands"
(0 real changes made)

. replace CID=    578     if nation=="Norway"
(21 real changes made)

. replace CID=    512     if nation=="Oman"
(21 real changes made)

. replace CID=    586     if nation=="Pakistan"
(21 real changes made)

. replace CID=    585     if nation=="Palau"
(0 real changes made)

. replace CID=    275     if nation=="Occupied Palestinian Territory"
(0 real changes made)

. replace CID=    591     if nation=="Panama"
(21 real changes made)

. replace CID=    598     if nation=="Papua New Guinea"
(21 real changes made)

. replace CID=    600     if nation=="Paraguay"
(21 real changes made)

. replace CID=    604     if nation=="Peru"
(21 real changes made)

. replace CID=    608     if nation=="Philippines"
(21 real changes made)

. replace CID=    612     if nation=="Pitcairn"
(0 real changes made)

. replace CID=    616     if nation=="Poland"
(21 real changes made)

. replace CID=    620     if nation=="Portugal"
(21 real changes made)

. replace CID=    630     if nation=="Puerto Rico"
(0 real changes made)

. replace CID=    634     if nation=="Qatar"
(21 real changes made)

. replace CID=    642     if nation=="Romania"
(21 real changes made)

. replace CID=    643     if nation=="Russian Federation"
(21 real changes made)

. replace CID=    646     if nation=="Rwanda"
(21 real changes made)

. replace CID=    638     if nation=="Reunion"
(0 real changes made)

. replace CID=    654     if nation=="Saint Helena"
(0 real changes made)

. replace CID=    659     if nation=="Saint Kitts and Nevis"
(0 real changes made)

. replace CID=    662     if nation=="Saint Lucia"
(0 real changes made)

. replace CID=    666     if nation=="Saint Pierre and Miquelon"
(0 real changes made)

. replace CID=    670     if nation=="Saint Vincent and Grenadines"
(0 real changes made)

. replace CID=    652     if nation=="Saint-Barthélemy"
(0 real changes made)

. replace CID=    663     if nation=="Saint-Martin (French part)"
(0 real changes made)

. replace CID=    882     if nation=="Samoa"
(0 real changes made)

. replace CID=    674     if nation=="San Marino"
(0 real changes made)

. replace CID=    678     if nation=="Sao Tome and Principe"
(0 real changes made)

. replace CID=    682     if nation=="Saudi Arabia"
(21 real changes made)

. replace CID=    686     if nation=="Senegal"
(21 real changes made)

. replace CID=    688     if nation=="Serbia"
(21 real changes made)

. replace CID=    690     if nation=="Seychelles"
(21 real changes made)

. replace CID=    694     if nation=="Sierra Leone"
(21 real changes made)

. replace CID=    702     if nation=="Singapore"
(21 real changes made)

. replace CID=    703     if nation=="Slovakia"
(0 real changes made)

. replace CID=    703     if nation=="Slovak Republic"
(21 real changes made)

. replace CID=    705     if nation=="Slovenia"
(21 real changes made)

. replace CID=    90      if nation=="Solomon Islands"
(0 real changes made)

. replace CID=    706     if nation=="Somalia"
(21 real changes made)

. replace CID=    710     if nation=="South Africa"
(21 real changes made)

. replace CID=    239     if nation=="South Georgia and the South Sandwich Islan
> ds"
(0 real changes made)

. replace CID=    728     if nation=="South Sudan"
(0 real changes made)

. replace CID=    724     if nation=="Spain"
(21 real changes made)

. replace CID=    144     if nation=="Sri Lanka"
(21 real changes made)

. replace CID=    736     if nation=="Sudan"
(21 real changes made)

. replace CID=    740     if nation=="Suriname"
(21 real changes made)

. replace CID=    744     if nation=="Svalbard and Jan Mayen Islands"
(0 real changes made)

. replace CID=    748     if nation=="Swaziland"
(0 real changes made)

. replace CID=    748     if nation=="Eswatini"
(21 real changes made)

. replace CID=    752     if nation=="Sweden"
(21 real changes made)

. replace CID=    756     if nation=="Switzerland"
(21 real changes made)

. replace CID=    760     if nation=="Syrian Arab Republic"
(21 real changes made)

. replace CID=    158     if nation=="Taiwan, Republic of China"
(0 real changes made)

. replace CID=    158     if nation=="Taiwan"
(21 real changes made)

. replace CID=    158     if nation=="China: Province of Taiwan only"
(0 real changes made)

. replace CID=    762     if nation=="Tajikistan"
(21 real changes made)

. replace CID=    834     if nation=="Tanzania *, United Republic of"
(0 real changes made)

. replace CID=    834     if nation=="Tanzania"
(21 real changes made)

. replace CID=    764     if nation=="Thailand"
(21 real changes made)

. replace CID=    626     if nation=="Timor-Leste"
(21 real changes made)

. replace CID=    768     if nation=="Togo"
(21 real changes made)

. replace CID=    772     if nation=="Tokelau"
(0 real changes made)

. replace CID=    776     if nation=="Tonga"
(0 real changes made)

. replace CID=    780     if nation=="Trinidad and Tobago"
(21 real changes made)

. replace CID=    788     if nation=="Tunisia"
(21 real changes made)

. replace CID=    792     if nation=="Turkey"
(21 real changes made)

. replace CID=    795     if nation=="Turkmenistan"
(0 real changes made)

. replace CID=    796     if nation=="Turks and Caicos Islands"
(0 real changes made)

. replace CID=    798     if nation=="Tuvalu"
(0 real changes made)

. replace CID=    800     if nation=="Uganda"
(21 real changes made)

. replace CID=    804     if nation=="Ukraine"
(21 real changes made)

. replace CID=    784     if nation=="United Arab Emirates"
(21 real changes made)

. replace CID=    826     if nation=="United Kingdom"
(21 real changes made)

. replace CID=    581     if nation=="United States Minor Outlying Islands"
(0 real changes made)

. replace CID=    840     if nation=="United States of America"
(0 real changes made)

. replace CID=    840     if nation=="United States"
(21 real changes made)

. replace CID=    858     if nation=="Uruguay"
(21 real changes made)

. replace CID=    860     if nation=="Uzbekistan"
(15 real changes made)

. replace CID=    548     if nation=="Vanuatu"
(0 real changes made)

. replace CID=    862     if nation=="Venezuela (Bolivarian Republic of)"
(0 real changes made)

. replace CID=    862     if nation=="Venezuela, RB"
(21 real changes made)

. replace CID=    862     if nation=="Venezuela"
(0 real changes made)

. replace CID=    704     if nation=="Viet Nam"
(0 real changes made)

. replace CID=    704     if nation=="Vietnam"
(21 real changes made)

. replace CID=    850     if nation=="Virgin Islands (USA)"
(0 real changes made)

. replace CID=    876     if nation=="Wallis and Futuna Islands"
(0 real changes made)

. replace CID=    732     if nation=="Western Sahara"
(0 real changes made)

. replace CID=    887     if nation=="Yemen"
(0 real changes made)

. replace CID=    887     if nation=="Yemen, Rep."
(21 real changes made)

. replace CID=    894     if nation=="Zambia"
(21 real changes made)

. replace CID=    716     if nation=="Zimbabwe"
(21 real changes made)

. 
. 
. replace CID=    200 if nation=="Czechoslovakia, Former"
(0 real changes made)

. replace CID=    278 if nation=="Germany, Former Democratic Republic"
(0 real changes made)

. replace CID=    280 if nation=="Germany, Former Federal Republic"
(0 real changes made)

. replace CID=    284 if nation=="Germany, West Berlin"
(0 real changes made)

. replace CID=    891     if nation=="Serbia and Montenegro, Former"
(0 real changes made)

. replace CID=    810 if nation=="USSR, Former"
(0 real changes made)

. replace CID=    890 if nation=="Yugoslavia, Former"
(0 real changes made)

. replace CID=    8260 if nation=="United Kingdom, England and Wales"
(0 real changes made)

. replace CID=    8261 if nation=="United Kingdom, Northern Ireland"
(0 real changes made)

. replace CID=    8262 if nation=="United Kingdom, Scotland"
(0 real changes made)

. replace CID=    650 if nation=="Ryu Kyu Islands"
(0 real changes made)

. replace CID=    9999 if nation=="Rodrigues"
(0 real changes made)

. 
. 
. 
end of do-file

. tab nation if CID==. 
no observations

. order CID nation year, first 

. save 00-Fraser.dta, replace 
file 00-Fraser.dta saved

. 
. 
. //      #1
. //      SP data
. insheet using OECD-SP-Public-Total-06-27-24.csv, comma clear n 
(44 vars, 38 obs)

. reshape long v,  j(year) i(Country)
(j = 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
>  30 31 32 33 34 35 36 37 38 39 40 41 42 43 44)

Data                               Wide   ->   Long
-----------------------------------------------------------------------------
Number of observations               38   ->   1,634       
Number of variables                  44   ->   3           
j variable (43 values)                    ->   year
xij variables:
                          v2 v3 ... v44   ->   v
-----------------------------------------------------------------------------

. rename Country nation 

. rename v public_sp

. 
. gen CID=. 
(1,634 missing values generated)

. do 00-CID-nation.do

. //  program:    Stata 14
. //  task:       Assigning CID #
. //  project:    SuiAlc 
. 
. //      #0A
. replace CID=    4       if nation=="Afghanistan"
(0 real changes made)

. replace CID=    248     if nation=="Aland Islands"
(0 real changes made)

. replace CID=    8       if nation=="Albania"
(0 real changes made)

. replace CID=    12      if nation=="Algeria"
(0 real changes made)

. replace CID=    16      if nation=="American Samoa"
(0 real changes made)

. replace CID=    20      if nation=="Andorra"
(0 real changes made)

. replace CID=    24      if nation=="Angola"
(0 real changes made)

. replace CID=    660     if nation=="Anguilla"
(0 real changes made)

. replace CID=    10      if nation=="Antarctica"
(0 real changes made)

. replace CID=    28      if nation=="Antigua and Barbuda"
(0 real changes made)

. replace CID=    32      if nation=="Argentina"
(0 real changes made)

. replace CID=    51      if nation=="Armenia"
(0 real changes made)

. replace CID=    533     if nation=="Aruba"
(0 real changes made)

. replace CID=    36      if nation=="Australia"
(43 real changes made)

. replace CID=    40      if nation=="Austria"
(43 real changes made)

. replace CID=    31      if nation=="Azerbaijan"
(0 real changes made)

. replace CID=    44      if nation=="Bahamas"
(0 real changes made)

. replace CID=    48      if nation=="Bahrain"
(0 real changes made)

. replace CID=    50      if nation=="Bangladesh"
(0 real changes made)

. replace CID=    52      if nation=="Barbados"
(0 real changes made)

. replace CID=    112     if nation=="Belarus"
(0 real changes made)

. replace CID=    56      if nation=="Belgium"
(43 real changes made)

. replace CID=    84      if nation=="Belize"
(0 real changes made)

. replace CID=    204     if nation=="Benin"
(0 real changes made)

. replace CID=    60      if nation=="Bermuda"
(0 real changes made)

. replace CID=    64      if nation=="Bhutan"
(0 real changes made)

. replace CID=    68      if nation=="Bolivia (Plurinational State of)"
(0 real changes made)

. replace CID=    70      if nation=="Bosnia and Herzegovina"
(0 real changes made)

. replace CID=    72      if nation=="Botswana"
(0 real changes made)

. replace CID=    74      if nation=="Bouvet Island"
(0 real changes made)

. replace CID=    76      if nation=="Brazil"
(0 real changes made)

. replace CID=    86      if nation=="British Indian Ocean Territory"
(0 real changes made)

. replace CID=    92      if nation=="British Virgin Islands"
(0 real changes made)

. replace CID=    96      if nation=="Brunei Darussalam"
(0 real changes made)

. replace CID=    100     if nation=="Bulgaria"
(0 real changes made)

. replace CID=    854     if nation=="Burkina Faso"
(0 real changes made)

. replace CID=    108     if nation=="Burundi"
(0 real changes made)

. replace CID=    116     if nation=="Cambodia"
(0 real changes made)

. replace CID=    120     if nation=="Cameroon"
(0 real changes made)

. replace CID=    124     if nation=="Canada"
(43 real changes made)

. replace CID=    132     if nation=="Cabo Verde"
(0 real changes made)

. replace CID=    136     if nation=="Cayman Islands"
(0 real changes made)

. replace CID=    140     if nation=="Central African Republic"
(0 real changes made)

. replace CID=    148     if nation=="Chad"
(0 real changes made)

. replace CID=    152     if nation=="Chile"
(43 real changes made)

. replace CID=    156     if nation=="China"
(0 real changes made)

. replace CID=    162     if nation=="Christmas Island"
(0 real changes made)

. replace CID=    166     if nation=="Cocos (Keeling) Islands"
(0 real changes made)

. replace CID=    170     if nation=="Colombia"
(43 real changes made)

. replace CID=    174     if nation=="Comoros"
(0 real changes made)

. replace CID=    178     if nation=="Congo"
(0 real changes made)

. replace CID=    180     if nation=="Congo (Democratic Republic of the)"
(0 real changes made)

. replace CID=    184     if nation=="Cook Islands"
(0 real changes made)

. replace CID=    188     if nation=="Costa Rica"
(43 real changes made)

. replace CID=    191     if nation=="Croatia"
(0 real changes made)

. replace CID=    192     if nation=="Cuba"
(0 real changes made)

. replace CID=    196     if nation=="Cyprus"
(0 real changes made)

. replace CID=    203     if nation=="Czech Republic"
(0 real changes made)

. replace CID=    203     if nation=="Czechia"
(43 real changes made)

. 
. replace CID=    384     if nation=="Cote d'Ivoire"
(0 real changes made)

. replace CID=    208     if nation=="Denmark"
(43 real changes made)

. replace CID=    262     if nation=="Djibouti"
(0 real changes made)

. replace CID=    212     if nation=="Dominica"
(0 real changes made)

. replace CID=    214     if nation=="Dominican Republic"
(0 real changes made)

. replace CID=    218     if nation=="Ecuador"
(0 real changes made)

. replace CID=    818     if nation=="Egypt"
(0 real changes made)

. replace CID=    222     if nation=="El Salvador"
(0 real changes made)

. replace CID=    226     if nation=="Equatorial Guinea"
(0 real changes made)

. replace CID=    232     if nation=="Eritrea"
(0 real changes made)

. replace CID=    233     if nation=="Estonia"
(43 real changes made)

. replace CID=    231     if nation=="Ethiopia"
(0 real changes made)

. replace CID=    238     if nation=="Falkland Islands (Malvinas)"
(0 real changes made)

. replace CID=    234     if nation=="Faroe Islands"
(0 real changes made)

. replace CID=    242     if nation=="Fiji"
(0 real changes made)

. replace CID=    246     if nation=="Finland"
(43 real changes made)

. replace CID=    250     if nation=="France"
(43 real changes made)

. replace CID=    254     if nation=="French Guiana"
(0 real changes made)

. replace CID=    258     if nation=="French Polynesia"
(0 real changes made)

. replace CID=    260     if nation=="French Southern Territories"
(0 real changes made)

. replace CID=    266     if nation=="Gabon"
(0 real changes made)

. replace CID=    270     if nation=="Gambia"
(0 real changes made)

. replace CID=    268     if nation=="Georgia"
(0 real changes made)

. replace CID=    276     if nation=="Germany"
(43 real changes made)

. replace CID=    288     if nation=="Ghana"
(0 real changes made)

. replace CID=    292     if nation=="Gibraltar"
(0 real changes made)

. replace CID=    300     if nation=="Greece"
(43 real changes made)

. replace CID=    304     if nation=="Greenland"
(0 real changes made)

. replace CID=    308     if nation=="Grenada"
(0 real changes made)

. replace CID=    312     if nation=="Guadeloupe"
(0 real changes made)

. replace CID=    316     if nation=="Guam"
(0 real changes made)

. replace CID=    320     if nation=="Guatemala"
(0 real changes made)

. replace CID=    831     if nation=="Guernsey"
(0 real changes made)

. replace CID=    324     if nation=="Guinea"
(0 real changes made)

. replace CID=    624     if nation=="Guinea-Bissau"
(0 real changes made)

. replace CID=    328     if nation=="Guyana"
(0 real changes made)

. replace CID=    332     if nation=="Haiti"
(0 real changes made)

. replace CID=    334     if nation=="Heard Island and Mcdonald Islands"
(0 real changes made)

. replace CID=    336     if nation=="Holy See (Vatican City State)"
(0 real changes made)

. replace CID=    340     if nation=="Honduras"
(0 real changes made)

. replace CID=    344     if nation==" Hong Kong, China (SAR)"
(0 real changes made)

. replace CID=    348     if nation=="Hungary"
(43 real changes made)

. replace CID=    352     if nation=="Iceland"
(43 real changes made)

. replace CID=    356     if nation=="India"
(0 real changes made)

. replace CID=    360     if nation=="Indonesia"
(0 real changes made)

. replace CID=    364     if nation=="Iran (Islamic Republic of)"
(0 real changes made)

. replace CID=    368     if nation=="Iraq"
(0 real changes made)

. replace CID=    372     if nation=="Ireland"
(43 real changes made)

. replace CID=    833     if nation=="Isle of Man"
(0 real changes made)

. replace CID=    376     if nation=="Israel"
(43 real changes made)

. replace CID=    380     if nation=="Italy"
(43 real changes made)

. replace CID=    388     if nation=="Jamaica"
(0 real changes made)

. replace CID=    392     if nation=="Japan"
(43 real changes made)

. replace CID=    832     if nation=="Jersey"
(0 real changes made)

. replace CID=    400     if nation=="Jordan"
(0 real changes made)

. replace CID=    398     if nation=="Kazakhstan"
(0 real changes made)

. replace CID=    404     if nation=="Kenya"
(0 real changes made)

. replace CID=    296     if nation=="Kiribati"
(0 real changes made)

. replace CID=    408     if nation=="Democratic People's Republic of Korea"
(0 real changes made)

. replace CID=    410     if nation=="Korea (Republic of)"
(0 real changes made)

. replace CID=    410     if nation=="Korea"
(43 real changes made)

. 
. replace CID=    414     if nation=="Kuwait"
(0 real changes made)

. replace CID=    417     if nation=="Kyrgyzstan"
(0 real changes made)

. replace CID=    418     if nation=="Lao People's Democratic Republic"
(0 real changes made)

. replace CID=    428     if nation=="Latvia"
(43 real changes made)

. replace CID=    422     if nation=="Lebanon"
(0 real changes made)

. replace CID=    426     if nation=="Lesotho"
(0 real changes made)

. replace CID=    430     if nation=="Liberia"
(0 real changes made)

. replace CID=    434     if nation=="Libya"
(0 real changes made)

. replace CID=    438     if nation=="Liechtenstein"
(0 real changes made)

. replace CID=    440     if nation=="Lithuania"
(43 real changes made)

. replace CID=    442     if nation=="Luxembourg"
(43 real changes made)

. replace CID=    446     if nation=="Macao Special Administrative Region of Chi
> na"
(0 real changes made)

. replace CID=    807     if nation=="The former Yugoslav Republic of Macedonia"
(0 real changes made)

. replace CID=    450     if nation=="Madagascar"
(0 real changes made)

. replace CID=    454     if nation=="Malawi"
(0 real changes made)

. replace CID=    458     if nation=="Malaysia"
(0 real changes made)

. replace CID=    462     if nation=="Maldives"
(0 real changes made)

. replace CID=    466     if nation=="Mali"
(0 real changes made)

. replace CID=    470     if nation=="Malta"
(0 real changes made)

. replace CID=    584     if nation=="Marshall Islands"
(0 real changes made)

. replace CID=    474     if nation=="Martinique"
(0 real changes made)

. replace CID=    478     if nation=="Mauritania"
(0 real changes made)

. replace CID=    480     if nation=="Mauritius"
(0 real changes made)

. replace CID=    175     if nation=="Mayotte"
(0 real changes made)

. replace CID=    484     if nation=="Mexico"
(43 real changes made)

. replace CID=    583     if nation=="Micronesia (Federated States of)"
(0 real changes made)

. replace CID=    498     if nation=="Moldova (Republic of)"
(0 real changes made)

. replace CID=    492     if nation=="Monaco"
(0 real changes made)

. replace CID=    496     if nation=="Mongolia"
(0 real changes made)

. replace CID=    499     if nation=="Montenegro"
(0 real changes made)

. replace CID=    500     if nation=="Montserrat"
(0 real changes made)

. replace CID=    504     if nation=="Morocco"
(0 real changes made)

. replace CID=    508     if nation=="Mozambique"
(0 real changes made)

. replace CID=    104     if nation=="Myanmar"
(0 real changes made)

. replace CID=    516     if nation=="Namibia"
(0 real changes made)

. replace CID=    520     if nation=="Nauru"
(0 real changes made)

. replace CID=    524     if nation=="Nepal"
(0 real changes made)

. replace CID=    528     if nation=="Netherlands"
(43 real changes made)

. replace CID=    530     if nation=="Netherlands Antilles"
(0 real changes made)

. replace CID=    540     if nation=="New Caledonia"
(0 real changes made)

. replace CID=    554     if nation=="New Zealand"
(43 real changes made)

. replace CID=    558     if nation=="Nicaragua"
(0 real changes made)

. replace CID=    562     if nation=="Niger"
(0 real changes made)

. replace CID=    566     if nation=="Nigeria"
(0 real changes made)

. replace CID=    570     if nation=="Niue"
(0 real changes made)

. replace CID=    574     if nation=="Norfolk Island"
(0 real changes made)

. replace CID=    580     if nation=="Northern Mariana Islands"
(0 real changes made)

. replace CID=    578     if nation=="Norway"
(43 real changes made)

. replace CID=    512     if nation=="Oman"
(0 real changes made)

. replace CID=    586     if nation=="Pakistan"
(0 real changes made)

. replace CID=    585     if nation=="Palau"
(0 real changes made)

. replace CID=    275     if nation=="Palestinian Territory, Occupied"
(0 real changes made)

. replace CID=    591     if nation=="Panama"
(0 real changes made)

. replace CID=    598     if nation=="Papua New Guinea"
(0 real changes made)

. replace CID=    600     if nation=="Paraguay"
(0 real changes made)

. replace CID=    604     if nation=="Peru"
(0 real changes made)

. replace CID=    608     if nation=="Philippines"
(0 real changes made)

. replace CID=    612     if nation=="Pitcairn"
(0 real changes made)

. replace CID=    616     if nation=="Poland"
(43 real changes made)

. replace CID=    620     if nation=="Portugal"
(43 real changes made)

. replace CID=    630     if nation=="Puerto Rico"
(0 real changes made)

. replace CID=    634     if nation=="Qatar"
(0 real changes made)

. replace CID=    642     if nation=="Romania"
(0 real changes made)

. replace CID=    643     if nation=="Russian Federation"
(0 real changes made)

. replace CID=    646     if nation=="Rwanda"
(0 real changes made)

. replace CID=    638     if nation=="Réunion"
(0 real changes made)

. replace CID=    654     if nation=="Saint Helena"
(0 real changes made)

. replace CID=    659     if nation=="Saint Kitts and Nevis"
(0 real changes made)

. replace CID=    662     if nation=="Saint Lucia"
(0 real changes made)

. replace CID=    666     if nation=="Saint Pierre and Miquelon"
(0 real changes made)

. replace CID=    670     if nation=="Saint Vincent and the Grenadines"
(0 real changes made)

. replace CID=    652     if nation=="Saint-Barthélemy"
(0 real changes made)

. replace CID=    663     if nation=="Saint-Martin (French part)"
(0 real changes made)

. replace CID=    882     if nation=="Samoa"
(0 real changes made)

. replace CID=    674     if nation=="San Marino"
(0 real changes made)

. replace CID=    678     if nation=="Sao Tome and Principe"
(0 real changes made)

. replace CID=    682     if nation=="Saudi Arabia"
(0 real changes made)

. replace CID=    686     if nation=="Senegal"
(0 real changes made)

. replace CID=    688     if nation=="Serbia"
(0 real changes made)

. replace CID=    690     if nation=="Seychelles"
(0 real changes made)

. replace CID=    694     if nation=="Sierra Leone"
(0 real changes made)

. replace CID=    702     if nation=="Singapore"
(0 real changes made)

. replace CID=    703     if nation=="Slovakia"
(0 real changes made)

. replace CID=    703     if nation=="Slovak Republic"
(43 real changes made)

. 
. replace CID=    705     if nation=="Slovenia"
(43 real changes made)

. replace CID=    90      if nation=="Solomon Islands"
(0 real changes made)

. replace CID=    706     if nation=="Somalia"
(0 real changes made)

. replace CID=    710     if nation=="South Africa"
(0 real changes made)

. replace CID=    239     if nation=="South Georgia and the South Sandwich Islan
> ds"
(0 real changes made)

. replace CID=    728     if nation=="South Sudan"
(0 real changes made)

. replace CID=    724     if nation=="Spain"
(43 real changes made)

. replace CID=    144     if nation=="Sri Lanka"
(0 real changes made)

. replace CID=    736     if nation=="Sudan"
(0 real changes made)

. replace CID=    740     if nation=="Suriname"
(0 real changes made)

. replace CID=    744     if nation=="Svalbard and Jan Mayen Islands"
(0 real changes made)

. replace CID=    748     if nation=="Swaziland"
(0 real changes made)

. replace CID=    752     if nation=="Sweden"
(43 real changes made)

. replace CID=    756     if nation=="Switzerland"
(43 real changes made)

. replace CID=    760     if nation=="Syrian Arab Republic"
(0 real changes made)

. replace CID=    158     if nation=="Taiwan, Republic of China"
(0 real changes made)

. replace CID=    762     if nation=="Tajikistan"
(0 real changes made)

. replace CID=    834     if nation=="Tanzania (United Republic of)"
(0 real changes made)

. replace CID=    764     if nation=="Thailand"
(0 real changes made)

. replace CID=    626     if nation=="Timor-Leste"
(0 real changes made)

. replace CID=    768     if nation=="Togo"
(0 real changes made)

. replace CID=    772     if nation=="Tokelau"
(0 real changes made)

. replace CID=    776     if nation=="Tonga"
(0 real changes made)

. replace CID=    780     if nation=="Trinidad and Tobago"
(0 real changes made)

. replace CID=    788     if nation=="Tunisia"
(0 real changes made)

. replace CID=    792     if nation=="Turkey"
(0 real changes made)

. replace CID=    792     if nation=="Türkiye"
(43 real changes made)

. replace CID=    795     if nation=="Turkmenistan"
(0 real changes made)

. replace CID=    796     if nation=="Turks and Caicos Islands"
(0 real changes made)

. replace CID=    798     if nation=="Tuvalu"
(0 real changes made)

. replace CID=    800     if nation=="Uganda"
(0 real changes made)

. replace CID=    804     if nation=="Ukraine"
(0 real changes made)

. replace CID=    784     if nation=="United Arab Emirates"
(0 real changes made)

. replace CID=    826     if nation=="United Kingdom"
(43 real changes made)

. replace CID=    581     if nation=="United States Minor Outlying Islands"
(0 real changes made)

. replace CID=    840     if nation=="United States"
(43 real changes made)

. replace CID=    858     if nation=="Uruguay"
(0 real changes made)

. replace CID=    860     if nation=="Uzbekistan"
(0 real changes made)

. replace CID=    548     if nation=="Vanuatu"
(0 real changes made)

. replace CID=    862     if nation=="Venezuela (Bolivarian Republic of)"
(0 real changes made)

. replace CID=    704     if nation=="Viet Nam"
(0 real changes made)

. replace CID=    850     if nation=="Virgin Islands, US"
(0 real changes made)

. replace CID=    876     if nation=="Wallis and Futuna Islands"
(0 real changes made)

. replace CID=    732     if nation=="Western Sahara"
(0 real changes made)

. replace CID=    887     if nation=="Yemen"
(0 real changes made)

. replace CID=    894     if nation=="Zambia"
(0 real changes made)

. replace CID=    716     if nation=="Zimbabwe"
(0 real changes made)

. 
. //
. 
end of do-file

. tab nation if CID==.
no observations

. order CID nation year, first 

. save SPOECD.dta, replace 
file SPOECD.dta saved

. 
. //      #2
. //      LaFree Globalization Data
. use KOFGI_2023_public.dta, clear 

. rename code countrycode

. gen CID=.
(11,180 missing values generated)

. do 00-CID-CountryCode.do

. replace CID=    4       if countrycode=="AFG"
(52 real changes made)

. replace CID=    248     if countrycode=="ALA"
(0 real changes made)

. replace CID=    8       if countrycode=="ALB"
(52 real changes made)

. replace CID=    12      if countrycode=="DZA"
(52 real changes made)

. replace CID=    16      if countrycode=="ASM"
(0 real changes made)

. replace CID=    20      if countrycode=="AND"
(0 real changes made)

. replace CID=    24      if countrycode=="AGO"
(52 real changes made)

. replace CID=    660     if countrycode=="AIA"
(0 real changes made)

. replace CID=    10      if countrycode=="ATA"
(0 real changes made)

. replace CID=    28      if countrycode=="ATG"
(52 real changes made)

. replace CID=    32      if countrycode=="ARG"
(52 real changes made)

. replace CID=    51      if countrycode=="ARM"
(52 real changes made)

. replace CID=    533     if countrycode=="ABW"
(52 real changes made)

. replace CID=    36      if countrycode=="AUS"
(52 real changes made)

. replace CID=    40      if countrycode=="AUT"
(52 real changes made)

. replace CID=    31      if countrycode=="AZE"
(52 real changes made)

. replace CID=    44      if countrycode=="BHS"
(52 real changes made)

. replace CID=    48      if countrycode=="BHR"
(52 real changes made)

. replace CID=    50      if countrycode=="BGD"
(52 real changes made)

. replace CID=    52      if countrycode=="BRB"
(52 real changes made)

. replace CID=    112     if countrycode=="BLR"
(52 real changes made)

. replace CID=    56      if countrycode=="BEL"
(52 real changes made)

. replace CID=    84      if countrycode=="BLZ"
(52 real changes made)

. replace CID=    204     if countrycode=="BEN"
(52 real changes made)

. replace CID=    60      if countrycode=="BMU"
(52 real changes made)

. replace CID=    64      if countrycode=="BTN"
(52 real changes made)

. replace CID=    68      if countrycode=="BOL"
(52 real changes made)

. replace CID=    70      if countrycode=="BIH"
(52 real changes made)

. replace CID=    72      if countrycode=="BWA"
(52 real changes made)

. replace CID=    74      if countrycode=="BVT"
(0 real changes made)

. replace CID=    76      if countrycode=="BRA"
(52 real changes made)

. replace CID=    86      if countrycode=="IOT"
(0 real changes made)

. replace CID=    92      if countrycode=="VGB"
(0 real changes made)

. replace CID=    96      if countrycode=="BRN"
(52 real changes made)

. replace CID=    100     if countrycode=="BGR"
(52 real changes made)

. replace CID=    854     if countrycode=="BFA"
(52 real changes made)

. replace CID=    108     if countrycode=="BDI"
(52 real changes made)

. replace CID=    116     if countrycode=="KHM"
(52 real changes made)

. replace CID=    120     if countrycode=="CMR"
(52 real changes made)

. replace CID=    124     if countrycode=="CAN"
(52 real changes made)

. replace CID=    132     if countrycode=="CPV"
(52 real changes made)

. replace CID=    136     if countrycode=="CYM"
(52 real changes made)

. replace CID=    140     if countrycode=="CAF"
(52 real changes made)

. replace CID=    148     if countrycode=="TCD"
(52 real changes made)

. replace CID=    152     if countrycode=="CHL"
(52 real changes made)

. replace CID=    156     if countrycode=="CHN"
(52 real changes made)

. replace CID=    162     if countrycode=="CXR"
(0 real changes made)

. replace CID=    166     if countrycode=="CCK"
(0 real changes made)

. replace CID=    170     if countrycode=="COL"
(52 real changes made)

. replace CID=    174     if countrycode=="COM"
(52 real changes made)

. replace CID=    178     if countrycode=="COG"
(52 real changes made)

. replace CID=    180     if countrycode=="COD"
(0 real changes made)

. replace CID=    184     if countrycode=="COK"
(0 real changes made)

. replace CID=    188     if countrycode=="CRI"
(52 real changes made)

. replace CID=    191     if countrycode=="HRV"
(52 real changes made)

. replace CID=    192     if countrycode=="CUB"
(52 real changes made)

. replace CID=    196     if countrycode=="CYP"
(52 real changes made)

. replace CID=    203     if countrycode=="CZE"
(52 real changes made)

. replace CID=    384     if countrycode=="CIV"
(52 real changes made)

. replace CID=    208     if countrycode=="DNK"
(52 real changes made)

. replace CID=    262     if countrycode=="DJI"
(52 real changes made)

. replace CID=    212     if countrycode=="DMA"
(52 real changes made)

. replace CID=    214     if countrycode=="DOM"
(52 real changes made)

. replace CID=    218     if countrycode=="ECU"
(52 real changes made)

. replace CID=    818     if countrycode=="EGY"
(52 real changes made)

. replace CID=    222     if countrycode=="SLV"
(52 real changes made)

. replace CID=    226     if countrycode=="GNQ"
(52 real changes made)

. replace CID=    232     if countrycode=="ERI"
(52 real changes made)

. replace CID=    233     if countrycode=="EST"
(52 real changes made)

. replace CID=    231     if countrycode=="ETH"
(52 real changes made)

. replace CID=    238     if countrycode=="FLK"
(0 real changes made)

. replace CID=    234     if countrycode=="FRO"
(52 real changes made)

. replace CID=    242     if countrycode=="FJI"
(52 real changes made)

. replace CID=    246     if countrycode=="FIN"
(52 real changes made)

. replace CID=    250     if countrycode=="FRA"
(52 real changes made)

. replace CID=    254     if countrycode=="GUF"
(0 real changes made)

. replace CID=    258     if countrycode=="PYF"
(52 real changes made)

. replace CID=    260     if countrycode=="ATF"
(0 real changes made)

. replace CID=    266     if countrycode=="GAB"
(52 real changes made)

. replace CID=    270     if countrycode=="GMB"
(52 real changes made)

. replace CID=    268     if countrycode=="GEO"
(52 real changes made)

. replace CID=    276     if countrycode=="DEU"
(52 real changes made)

. replace CID=    288     if countrycode=="GHA"
(52 real changes made)

. replace CID=    292     if countrycode=="GIB"
(0 real changes made)

. replace CID=    300     if countrycode=="GRC"
(52 real changes made)

. replace CID=    304     if countrycode=="GRL"
(52 real changes made)

. replace CID=    308     if countrycode=="GRD"
(52 real changes made)

. replace CID=    312     if countrycode=="GLP"
(0 real changes made)

. replace CID=    316     if countrycode=="GUM"
(52 real changes made)

. replace CID=    320     if countrycode=="GTM"
(52 real changes made)

. replace CID=    831     if countrycode=="GGY"
(0 real changes made)

. replace CID=    324     if countrycode=="GIN"
(52 real changes made)

. replace CID=    624     if countrycode=="GNB"
(52 real changes made)

. replace CID=    328     if countrycode=="GUY"
(52 real changes made)

. replace CID=    332     if countrycode=="HTI"
(52 real changes made)

. replace CID=    334     if countrycode=="HMD"
(0 real changes made)

. replace CID=    336     if countrycode=="VAT"
(0 real changes made)

. replace CID=    340     if countrycode=="HND"
(52 real changes made)

. replace CID=    344     if countrycode=="HKG"
(52 real changes made)

. replace CID=    348     if countrycode=="HUN"
(52 real changes made)

. replace CID=    352     if countrycode=="ISL"
(52 real changes made)

. replace CID=    356     if countrycode=="IND"
(52 real changes made)

. replace CID=    360     if countrycode=="IDN"
(52 real changes made)

. replace CID=    364     if countrycode=="IRN"
(52 real changes made)

. replace CID=    368     if countrycode=="IRQ"
(52 real changes made)

. replace CID=    372     if countrycode=="IRL"
(52 real changes made)

. replace CID=    833     if countrycode=="IMN"
(0 real changes made)

. replace CID=    376     if countrycode=="ISR"
(52 real changes made)

. replace CID=    380     if countrycode=="ITA"
(52 real changes made)

. replace CID=    388     if countrycode=="JAM"
(52 real changes made)

. replace CID=    392     if countrycode=="JPN"
(52 real changes made)

. replace CID=    832     if countrycode=="JEY"
(0 real changes made)

. replace CID=    400     if countrycode=="JOR"
(52 real changes made)

. replace CID=    398     if countrycode=="KAZ"
(52 real changes made)

. replace CID=    404     if countrycode=="KEN"
(52 real changes made)

. replace CID=    296     if countrycode=="KIR"
(52 real changes made)

. replace CID=    408     if countrycode=="PRK"
(52 real changes made)

. replace CID=    410     if countrycode=="KOR"
(52 real changes made)

. replace CID=    414     if countrycode=="KWT"
(52 real changes made)

. replace CID=    417     if countrycode=="KGZ"
(52 real changes made)

. replace CID=    418     if countrycode=="LAO"
(52 real changes made)

. replace CID=    428     if countrycode=="LVA"
(52 real changes made)

. replace CID=    422     if countrycode=="LBN"
(52 real changes made)

. replace CID=    426     if countrycode=="LSO"
(52 real changes made)

. replace CID=    430     if countrycode=="LBR"
(52 real changes made)

. replace CID=    434     if countrycode=="LBY"
(52 real changes made)

. replace CID=    438     if countrycode=="LIE"
(52 real changes made)

. replace CID=    440     if countrycode=="LTU"
(52 real changes made)

. replace CID=    442     if countrycode=="LUX"
(52 real changes made)

. replace CID=    446     if countrycode=="MAC"
(52 real changes made)

. replace CID=    807     if countrycode=="MKD"
(52 real changes made)

. replace CID=    450     if countrycode=="MDG"
(52 real changes made)

. replace CID=    454     if countrycode=="MWI"
(52 real changes made)

. replace CID=    458     if countrycode=="MYS"
(52 real changes made)

. replace CID=    462     if countrycode=="MDV"
(52 real changes made)

. replace CID=    466     if countrycode=="MLI"
(52 real changes made)

. replace CID=    470     if countrycode=="MLT"
(52 real changes made)

. replace CID=    584     if countrycode=="MHL"
(52 real changes made)

. replace CID=    474     if countrycode=="MTQ"
(0 real changes made)

. replace CID=    478     if countrycode=="MRT"
(52 real changes made)

. replace CID=    480     if countrycode=="MUS"
(52 real changes made)

. replace CID=    175     if countrycode=="MYT"
(0 real changes made)

. replace CID=    484     if countrycode=="MEX"
(52 real changes made)

. replace CID=    583     if countrycode=="FSM"
(52 real changes made)

. replace CID=    498     if countrycode=="MDA"
(52 real changes made)

. replace CID=    492     if countrycode=="MCO"
(52 real changes made)

. replace CID=    496     if countrycode=="MNG"
(52 real changes made)

. replace CID=    499     if countrycode=="MNE"
(52 real changes made)

. replace CID=    500     if countrycode=="MSR"
(0 real changes made)

. replace CID=    504     if countrycode=="MAR"
(52 real changes made)

. replace CID=    508     if countrycode=="MOZ"
(52 real changes made)

. replace CID=    104     if countrycode=="MMR"
(52 real changes made)

. replace CID=    516     if countrycode=="NAM"
(52 real changes made)

. replace CID=    520     if countrycode=="NRU"
(0 real changes made)

. replace CID=    524     if countrycode=="NPL"
(52 real changes made)

. replace CID=    528     if countrycode=="NLD"
(52 real changes made)

. replace CID=    530     if countrycode=="ANT"
(0 real changes made)

. replace CID=    540     if countrycode=="NCL"
(52 real changes made)

. replace CID=    554     if countrycode=="NZL"
(52 real changes made)

. replace CID=    558     if countrycode=="NIC"
(52 real changes made)

. replace CID=    562     if countrycode=="NER"
(52 real changes made)

. replace CID=    566     if countrycode=="NGA"
(52 real changes made)

. replace CID=    570     if countrycode=="NIU"
(0 real changes made)

. replace CID=    574     if countrycode=="NFK"
(0 real changes made)

. replace CID=    580     if countrycode=="MNP"
(0 real changes made)

. replace CID=    578     if countrycode=="NOR"
(52 real changes made)

. replace CID=    512     if countrycode=="OMN"
(52 real changes made)

. replace CID=    586     if countrycode=="PAK"
(52 real changes made)

. replace CID=    585     if countrycode=="PLW"
(52 real changes made)

. replace CID=    275     if countrycode=="PSE"
(0 real changes made)

. replace CID=    591     if countrycode=="PAN"
(52 real changes made)

. replace CID=    598     if countrycode=="PNG"
(52 real changes made)

. replace CID=    600     if countrycode=="PRY"
(52 real changes made)

. replace CID=    604     if countrycode=="PER"
(52 real changes made)

. replace CID=    608     if countrycode=="PHL"
(52 real changes made)

. replace CID=    612     if countrycode=="PCN"
(0 real changes made)

. replace CID=    616     if countrycode=="POL"
(52 real changes made)

. replace CID=    620     if countrycode=="PRT"
(52 real changes made)

. replace CID=    630     if countrycode=="PRI"
(52 real changes made)

. replace CID=    634     if countrycode=="QAT"
(52 real changes made)

. replace CID=    642     if countrycode=="ROU"
(0 real changes made)

. replace CID=    643     if countrycode=="RUS"
(52 real changes made)

. replace CID=    646     if countrycode=="RWA"
(52 real changes made)

. replace CID=    638     if countrycode=="REU"
(0 real changes made)

. replace CID=    654     if countrycode=="SHN"
(0 real changes made)

. replace CID=    659     if countrycode=="KNA"
(52 real changes made)

. replace CID=    662     if countrycode=="LCA"
(52 real changes made)

. replace CID=    666     if countrycode=="SPM"
(0 real changes made)

. replace CID=    670     if countrycode=="VCT"
(52 real changes made)

. replace CID=    652     if countrycode=="BLM"
(0 real changes made)

. replace CID=    663     if countrycode=="MAF"
(0 real changes made)

. replace CID=    882     if countrycode=="WSM"
(52 real changes made)

. replace CID=    674     if countrycode=="SMR"
(52 real changes made)

. replace CID=    678     if countrycode=="STP"
(52 real changes made)

. replace CID=    682     if countrycode=="SAU"
(52 real changes made)

. replace CID=    686     if countrycode=="SEN"
(52 real changes made)

. replace CID=    688     if countrycode=="SRB"
(52 real changes made)

. replace CID=    690     if countrycode=="SYC"
(52 real changes made)

. replace CID=    694     if countrycode=="SLE"
(52 real changes made)

. replace CID=    702     if countrycode=="SGP"
(52 real changes made)

. replace CID=    703     if countrycode=="SVK"
(52 real changes made)

. replace CID=    705     if countrycode=="SVN"
(52 real changes made)

. replace CID=    90      if countrycode=="SLB"
(52 real changes made)

. replace CID=    706     if countrycode=="SOM"
(52 real changes made)

. replace CID=    710     if countrycode=="ZAF"
(52 real changes made)

. replace CID=    239     if countrycode=="SGS"
(0 real changes made)

. replace CID=    728     if countrycode=="SSD"
(0 real changes made)

. replace CID=    724     if countrycode=="ESP"
(52 real changes made)

. replace CID=    144     if countrycode=="LKA"
(52 real changes made)

. replace CID=    736     if countrycode=="SDN"
(52 real changes made)

. replace CID=    740     if countrycode=="SUR"
(52 real changes made)

. replace CID=    744     if countrycode=="SJM"
(0 real changes made)

. replace CID=    748     if countrycode=="SWZ"
(52 real changes made)

. replace CID=    752     if countrycode=="SWE"
(52 real changes made)

. replace CID=    756     if countrycode=="CHE"
(52 real changes made)

. replace CID=    760     if countrycode=="SYR"
(52 real changes made)

. replace CID=    158     if countrycode=="TWN"
(0 real changes made)

. replace CID=    762     if countrycode=="TJK"
(52 real changes made)

. replace CID=    834     if countrycode=="TZA"
(52 real changes made)

. replace CID=    764     if countrycode=="THA"
(52 real changes made)

. replace CID=    626     if countrycode=="TLS"
(0 real changes made)

. replace CID=    768     if countrycode=="TGO"
(52 real changes made)

. replace CID=    772     if countrycode=="TKL"
(0 real changes made)

. replace CID=    776     if countrycode=="TON"
(52 real changes made)

. replace CID=    780     if countrycode=="TTO"
(52 real changes made)

. replace CID=    788     if countrycode=="TUN"
(52 real changes made)

. replace CID=    792     if countrycode=="TUR"
(52 real changes made)

. replace CID=    795     if countrycode=="TKM"
(52 real changes made)

. replace CID=    796     if countrycode=="TCA"
(0 real changes made)

. replace CID=    798     if countrycode=="TUV"
(0 real changes made)

. replace CID=    800     if countrycode=="UGA"
(52 real changes made)

. replace CID=    804     if countrycode=="UKR"
(52 real changes made)

. replace CID=    784     if countrycode=="ARE"
(52 real changes made)

. replace CID=    826     if countrycode=="GBR"
(52 real changes made)

. replace CID=    581     if countrycode=="UMI"
(0 real changes made)

. replace CID=    840     if countrycode=="USA"
(52 real changes made)

. replace CID=    858     if countrycode=="URY"
(52 real changes made)

. replace CID=    860     if countrycode=="UZB"
(52 real changes made)

. replace CID=    548     if countrycode=="VUT"
(52 real changes made)

. replace CID=    862     if countrycode=="VEN"
(52 real changes made)

. replace CID=    704     if countrycode=="VNM"
(52 real changes made)

. replace CID=    850     if countrycode=="VIR"
(52 real changes made)

. replace CID=    876     if countrycode=="WLF"
(0 real changes made)

. replace CID=    732     if countrycode=="ESH"
(0 real changes made)

. replace CID=    887     if countrycode=="YEM"
(52 real changes made)

. replace CID=    894     if countrycode=="ZMB"
(52 real changes made)

. replace CID=    716     if countrycode=="ZWE"
(52 real changes made)

. 
. 
end of do-file

. rename country nation 

. replace CID=642 if countrycode=="ROM"
(52 real changes made)

. tab nation if CID==.

                      country |      Freq.     Percent        Cum.
------------------------------+-----------------------------------
                      Andorra |         52        6.25        6.25
               Congo, Dem Rep |         52        6.25       12.50
        East Asia and Pacific |         52        6.25       18.75
      Europe and Central Asia |         52        6.25       25.00
                  High income |         52        6.25       31.25
  Latin America and Caribbean |         52        6.25       37.50
                   Low income |         52        6.25       43.75
          Lower middle income |         52        6.25       50.00
 Middle East and North Africa |         52        6.25       56.25
                North America |         52        6.25       62.50
                   South Asia |         52        6.25       68.75
           Sub-Saharan Africa |         52        6.25       75.00
                  Timor-Leste |         52        6.25       81.25
          Upper middle income |         52        6.25       87.50
           West Bank and Gaza |         52        6.25       93.75
                        World |         52        6.25      100.00
------------------------------+-----------------------------------
                        Total |        832      100.00

. drop if CID==.
(832 observations deleted)

. order CID nation year, first 

. save KOFGI.dta, replace 
file KOFGI.dta saved

. 
. 
. //      #3
. //      UNODC Data 
. insheet using UNODC-Homicide-05-05-25.csv, comma clear n 
(13 vars, 118,401 obs)

. 
. rename Iso3_code countrycode 

. rename country nation 

. 
. drop if dimension!="Total"
(53,115 observations deleted)

. drop if indicator!="Victims of intentional homicide"
(22,149 observations deleted)

. drop if sex!="Total"
(34,639 observations deleted)

. drop if age!="Total"
(0 observations deleted)

. tab1 indicator dimension category sex age 

-> tabulation of indicator  

                              Indicator |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
        Victims of intentional homicide |      8,498      100.00      100.00
----------------------------------------+-----------------------------------
                                  Total |      8,498      100.00

-> tabulation of dimension  

                     Dimension |      Freq.     Percent        Cum.
-------------------------------+-----------------------------------
                         Total |      8,498      100.00      100.00
-------------------------------+-----------------------------------
                         Total |      8,498      100.00

-> tabulation of category  

                               Category |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
                                  Total |      8,498      100.00      100.00
----------------------------------------+-----------------------------------
                                  Total |      8,498      100.00

-> tabulation of sex  

        Sex |      Freq.     Percent        Cum.
------------+-----------------------------------
      Total |      8,498      100.00      100.00
------------+-----------------------------------
      Total |      8,498      100.00

-> tabulation of age  

         Age |      Freq.     Percent        Cum.
-------------+-----------------------------------
       Total |      8,498      100.00      100.00
-------------+-----------------------------------
       Total |      8,498      100.00

. drop indicator dimension category sex age 

. 
. gen CID=. 
(8,498 missing values generated)

. do 00-CID-CountryCode.do

. replace CID=    4       if countrycode=="AFG"
(22 real changes made)

. replace CID=    248     if countrycode=="ALA"
(0 real changes made)

. replace CID=    8       if countrycode=="ALB"
(64 real changes made)

. replace CID=    12      if countrycode=="DZA"
(36 real changes made)

. replace CID=    16      if countrycode=="ASM"
(38 real changes made)

. replace CID=    20      if countrycode=="AND"
(22 real changes made)

. replace CID=    24      if countrycode=="AGO"
(8 real changes made)

. replace CID=    660     if countrycode=="AIA"
(50 real changes made)

. replace CID=    10      if countrycode=="ATA"
(0 real changes made)

. replace CID=    28      if countrycode=="ATG"
(52 real changes made)

. replace CID=    32      if countrycode=="ARG"
(44 real changes made)

. replace CID=    51      if countrycode=="ARM"
(62 real changes made)

. replace CID=    533     if countrycode=="ABW"
(34 real changes made)

. replace CID=    36      if countrycode=="AUS"
(68 real changes made)

. replace CID=    40      if countrycode=="AUT"
(68 real changes made)

. replace CID=    31      if countrycode=="AZE"
(56 real changes made)

. replace CID=    44      if countrycode=="BHS"
(62 real changes made)

. replace CID=    48      if countrycode=="BHR"
(42 real changes made)

. replace CID=    50      if countrycode=="BGD"
(38 real changes made)

. replace CID=    52      if countrycode=="BRB"
(62 real changes made)

. replace CID=    112     if countrycode=="BLR"
(52 real changes made)

. replace CID=    56      if countrycode=="BEL"
(24 real changes made)

. replace CID=    84      if countrycode=="BLZ"
(46 real changes made)

. replace CID=    204     if countrycode=="BEN"
(0 real changes made)

. replace CID=    60      if countrycode=="BMU"
(66 real changes made)

. replace CID=    64      if countrycode=="BTN"
(60 real changes made)

. replace CID=    68      if countrycode=="BOL"
(18 real changes made)

. replace CID=    70      if countrycode=="BIH"
(44 real changes made)

. replace CID=    72      if countrycode=="BWA"
(24 real changes made)

. replace CID=    74      if countrycode=="BVT"
(0 real changes made)

. replace CID=    76      if countrycode=="BRA"
(66 real changes made)

. replace CID=    86      if countrycode=="IOT"
(0 real changes made)

. replace CID=    92      if countrycode=="VGB"
(26 real changes made)

. replace CID=    96      if countrycode=="BRN"
(32 real changes made)

. replace CID=    100     if countrycode=="BGR"
(68 real changes made)

. replace CID=    854     if countrycode=="BFA"
(0 real changes made)

. replace CID=    108     if countrycode=="BDI"
(10 real changes made)

. replace CID=    116     if countrycode=="KHM"
(40 real changes made)

. replace CID=    120     if countrycode=="CMR"
(26 real changes made)

. replace CID=    124     if countrycode=="CAN"
(66 real changes made)

. replace CID=    132     if countrycode=="CPV"
(24 real changes made)

. replace CID=    136     if countrycode=="CYM"
(54 real changes made)

. replace CID=    140     if countrycode=="CAF"
(0 real changes made)

. replace CID=    148     if countrycode=="TCD"
(0 real changes made)

. replace CID=    152     if countrycode=="CHL"
(38 real changes made)

. replace CID=    156     if countrycode=="CHN"
(44 real changes made)

. replace CID=    162     if countrycode=="CXR"
(0 real changes made)

. replace CID=    166     if countrycode=="CCK"
(0 real changes made)

. replace CID=    170     if countrycode=="COL"
(66 real changes made)

. replace CID=    174     if countrycode=="COM"
(0 real changes made)

. replace CID=    178     if countrycode=="COG"
(0 real changes made)

. replace CID=    180     if countrycode=="COD"
(0 real changes made)

. replace CID=    184     if countrycode=="COK"
(2 real changes made)

. replace CID=    188     if countrycode=="CRI"
(68 real changes made)

. replace CID=    191     if countrycode=="HRV"
(66 real changes made)

. replace CID=    192     if countrycode=="CUB"
(56 real changes made)

. replace CID=    196     if countrycode=="CYP"
(66 real changes made)

. replace CID=    203     if countrycode=="CZE"
(58 real changes made)

. replace CID=    384     if countrycode=="CIV"
(0 real changes made)

. replace CID=    208     if countrycode=="DNK"
(52 real changes made)

. replace CID=    262     if countrycode=="DJI"
(0 real changes made)

. replace CID=    212     if countrycode=="DMA"
(46 real changes made)

. replace CID=    214     if countrycode=="DOM"
(62 real changes made)

. replace CID=    218     if countrycode=="ECU"
(60 real changes made)

. replace CID=    818     if countrycode=="EGY"
(38 real changes made)

. replace CID=    222     if countrycode=="SLV"
(58 real changes made)

. replace CID=    226     if countrycode=="GNQ"
(0 real changes made)

. replace CID=    232     if countrycode=="ERI"
(2 real changes made)

. replace CID=    233     if countrycode=="EST"
(60 real changes made)

. replace CID=    231     if countrycode=="ETH"
(2 real changes made)

. replace CID=    238     if countrycode=="FLK"
(0 real changes made)

. replace CID=    234     if countrycode=="FRO"
(0 real changes made)

. replace CID=    242     if countrycode=="FJI"
(42 real changes made)

. replace CID=    246     if countrycode=="FIN"
(68 real changes made)

. replace CID=    250     if countrycode=="FRA"
(68 real changes made)

. replace CID=    254     if countrycode=="GUF"
(18 real changes made)

. replace CID=    258     if countrycode=="PYF"
(8 real changes made)

. replace CID=    260     if countrycode=="ATF"
(0 real changes made)

. replace CID=    266     if countrycode=="GAB"
(0 real changes made)

. replace CID=    270     if countrycode=="GMB"
(0 real changes made)

. replace CID=    268     if countrycode=="GEO"
(48 real changes made)

. replace CID=    276     if countrycode=="DEU"
(66 real changes made)

. replace CID=    288     if countrycode=="GHA"
(44 real changes made)

. replace CID=    292     if countrycode=="GIB"
(4 real changes made)

. replace CID=    300     if countrycode=="GRC"
(64 real changes made)

. replace CID=    304     if countrycode=="GRL"
(50 real changes made)

. replace CID=    308     if countrycode=="GRD"
(46 real changes made)

. replace CID=    312     if countrycode=="GLP"
(24 real changes made)

. replace CID=    316     if countrycode=="GUM"
(26 real changes made)

. replace CID=    320     if countrycode=="GTM"
(58 real changes made)

. replace CID=    831     if countrycode=="GGY"
(0 real changes made)

. replace CID=    324     if countrycode=="GIN"
(0 real changes made)

. replace CID=    624     if countrycode=="GNB"
(4 real changes made)

. replace CID=    328     if countrycode=="GUY"
(66 real changes made)

. replace CID=    332     if countrycode=="HTI"
(30 real changes made)

. replace CID=    334     if countrycode=="HMD"
(0 real changes made)

. replace CID=    336     if countrycode=="VAT"
(24 real changes made)

. replace CID=    340     if countrycode=="HND"
(62 real changes made)

. replace CID=    344     if countrycode=="HKG"
(66 real changes made)

. replace CID=    348     if countrycode=="HUN"
(68 real changes made)

. replace CID=    352     if countrycode=="ISL"
(54 real changes made)

. replace CID=    356     if countrycode=="IND"
(66 real changes made)

. replace CID=    360     if countrycode=="IDN"
(12 real changes made)

. replace CID=    364     if countrycode=="IRN"
(6 real changes made)

. replace CID=    368     if countrycode=="IRQ"
(22 real changes made)

. replace CID=    372     if countrycode=="IRL"
(68 real changes made)

. replace CID=    833     if countrycode=="IMN"
(12 real changes made)

. replace CID=    376     if countrycode=="ISR"
(66 real changes made)

. replace CID=    380     if countrycode=="ITA"
(62 real changes made)

. replace CID=    388     if countrycode=="JAM"
(68 real changes made)

. replace CID=    392     if countrycode=="JPN"
(66 real changes made)

. replace CID=    832     if countrycode=="JEY"
(0 real changes made)

. replace CID=    400     if countrycode=="JOR"
(50 real changes made)

. replace CID=    398     if countrycode=="KAZ"
(54 real changes made)

. replace CID=    404     if countrycode=="KEN"
(36 real changes made)

. replace CID=    296     if countrycode=="KIR"
(32 real changes made)

. replace CID=    408     if countrycode=="PRK"
(0 real changes made)

. replace CID=    410     if countrycode=="KOR"
(66 real changes made)

. replace CID=    414     if countrycode=="KWT"
(34 real changes made)

. replace CID=    417     if countrycode=="KGZ"
(0 real changes made)

. replace CID=    418     if countrycode=="LAO"
(0 real changes made)

. replace CID=    428     if countrycode=="LVA"
(46 real changes made)

. replace CID=    422     if countrycode=="LBN"
(26 real changes made)

. replace CID=    426     if countrycode=="LSO"
(14 real changes made)

. replace CID=    430     if countrycode=="LBR"
(12 real changes made)

. replace CID=    434     if countrycode=="LBY"
(0 real changes made)

. replace CID=    438     if countrycode=="LIE"
(52 real changes made)

. replace CID=    440     if countrycode=="LTU"
(66 real changes made)

. replace CID=    442     if countrycode=="LUX"
(58 real changes made)

. replace CID=    446     if countrycode=="MAC"
(66 real changes made)

. replace CID=    807     if countrycode=="MKD"
(50 real changes made)

. replace CID=    450     if countrycode=="MDG"
(0 real changes made)

. replace CID=    454     if countrycode=="MWI"
(26 real changes made)

. replace CID=    458     if countrycode=="MYS"
(64 real changes made)

. replace CID=    462     if countrycode=="MDV"
(28 real changes made)

. replace CID=    466     if countrycode=="MLI"
(0 real changes made)

. replace CID=    470     if countrycode=="MLT"
(60 real changes made)

. replace CID=    584     if countrycode=="MHL"
(6 real changes made)

. replace CID=    474     if countrycode=="MTQ"
(12 real changes made)

. replace CID=    478     if countrycode=="MRT"
(6 real changes made)

. replace CID=    480     if countrycode=="MUS"
(50 real changes made)

. replace CID=    175     if countrycode=="MYT"
(6 real changes made)

. replace CID=    484     if countrycode=="MEX"
(68 real changes made)

. replace CID=    583     if countrycode=="FSM"
(2 real changes made)

. replace CID=    498     if countrycode=="MDA"
(68 real changes made)

. replace CID=    492     if countrycode=="MCO"
(6 real changes made)

. replace CID=    496     if countrycode=="MNG"
(42 real changes made)

. replace CID=    499     if countrycode=="MNE"
(36 real changes made)

. replace CID=    500     if countrycode=="MSR"
(42 real changes made)

. replace CID=    504     if countrycode=="MAR"
(64 real changes made)

. replace CID=    508     if countrycode=="MOZ"
(22 real changes made)

. replace CID=    104     if countrycode=="MMR"
(50 real changes made)

. replace CID=    516     if countrycode=="NAM"
(36 real changes made)

. replace CID=    520     if countrycode=="NRU"
(0 real changes made)

. replace CID=    524     if countrycode=="NPL"
(50 real changes made)

. replace CID=    528     if countrycode=="NLD"
(68 real changes made)

. replace CID=    530     if countrycode=="ANT"
(0 real changes made)

. replace CID=    540     if countrycode=="NCL"
(8 real changes made)

. replace CID=    554     if countrycode=="NZL"
(64 real changes made)

. replace CID=    558     if countrycode=="NIC"
(62 real changes made)

. replace CID=    562     if countrycode=="NER"
(4 real changes made)

. replace CID=    566     if countrycode=="NGA"
(4 real changes made)

. replace CID=    570     if countrycode=="NIU"
(0 real changes made)

. replace CID=    574     if countrycode=="NFK"
(0 real changes made)

. replace CID=    580     if countrycode=="MNP"
(0 real changes made)

. replace CID=    578     if countrycode=="NOR"
(66 real changes made)

. replace CID=    512     if countrycode=="OMN"
(44 real changes made)

. replace CID=    586     if countrycode=="PAK"
(58 real changes made)

. replace CID=    585     if countrycode=="PLW"
(8 real changes made)

. replace CID=    275     if countrycode=="PSE"
(50 real changes made)

. replace CID=    591     if countrycode=="PAN"
(66 real changes made)

. replace CID=    598     if countrycode=="PNG"
(24 real changes made)

. replace CID=    600     if countrycode=="PRY"
(46 real changes made)

. replace CID=    604     if countrycode=="PER"
(22 real changes made)

. replace CID=    608     if countrycode=="PHL"
(40 real changes made)

. replace CID=    612     if countrycode=="PCN"
(0 real changes made)

. replace CID=    616     if countrycode=="POL"
(58 real changes made)

. replace CID=    620     if countrycode=="PRT"
(54 real changes made)

. replace CID=    630     if countrycode=="PRI"
(68 real changes made)

. replace CID=    634     if countrycode=="QAT"
(56 real changes made)

. replace CID=    642     if countrycode=="ROU"
(68 real changes made)

. replace CID=    643     if countrycode=="RUS"
(64 real changes made)

. replace CID=    646     if countrycode=="RWA"
(26 real changes made)

. replace CID=    638     if countrycode=="REU"
(12 real changes made)

. replace CID=    654     if countrycode=="SHN"
(32 real changes made)

. replace CID=    659     if countrycode=="KNA"
(50 real changes made)

. replace CID=    662     if countrycode=="LCA"
(66 real changes made)

. replace CID=    666     if countrycode=="SPM"
(8 real changes made)

. replace CID=    670     if countrycode=="VCT"
(56 real changes made)

. replace CID=    652     if countrycode=="BLM"
(0 real changes made)

. replace CID=    663     if countrycode=="MAF"
(12 real changes made)

. replace CID=    882     if countrycode=="WSM"
(10 real changes made)

. replace CID=    674     if countrycode=="SMR"
(34 real changes made)

. replace CID=    678     if countrycode=="STP"
(22 real changes made)

. replace CID=    682     if countrycode=="SAU"
(22 real changes made)

. replace CID=    686     if countrycode=="SEN"
(0 real changes made)

. replace CID=    688     if countrycode=="SRB"
(48 real changes made)

. replace CID=    690     if countrycode=="SYC"
(36 real changes made)

. replace CID=    694     if countrycode=="SLE"
(22 real changes made)

. replace CID=    702     if countrycode=="SGP"
(66 real changes made)

. replace CID=    703     if countrycode=="SVK"
(66 real changes made)

. replace CID=    705     if countrycode=="SVN"
(68 real changes made)

. replace CID=    90      if countrycode=="SLB"
(10 real changes made)

. replace CID=    706     if countrycode=="SOM"
(0 real changes made)

. replace CID=    710     if countrycode=="ZAF"
(58 real changes made)

. replace CID=    239     if countrycode=="SGS"
(0 real changes made)

. replace CID=    728     if countrycode=="SSD"
(2 real changes made)

. replace CID=    724     if countrycode=="ESP"
(68 real changes made)

. replace CID=    144     if countrycode=="LKA"
(38 real changes made)

. replace CID=    736     if countrycode=="SDN"
(0 real changes made)

. replace CID=    740     if countrycode=="SUR"
(38 real changes made)

. replace CID=    744     if countrycode=="SJM"
(0 real changes made)

. replace CID=    748     if countrycode=="SWZ"
(52 real changes made)

. replace CID=    752     if countrycode=="SWE"
(68 real changes made)

. replace CID=    756     if countrycode=="CHE"
(56 real changes made)

. replace CID=    760     if countrycode=="SYR"
(28 real changes made)

. replace CID=    158     if countrycode=="TWN"
(0 real changes made)

. replace CID=    762     if countrycode=="TJK"
(46 real changes made)

. replace CID=    834     if countrycode=="TZA"
(30 real changes made)

. replace CID=    764     if countrycode=="THA"
(44 real changes made)

. replace CID=    626     if countrycode=="TLS"
(16 real changes made)

. replace CID=    768     if countrycode=="TGO"
(0 real changes made)

. replace CID=    772     if countrycode=="TKL"
(0 real changes made)

. replace CID=    776     if countrycode=="TON"
(36 real changes made)

. replace CID=    780     if countrycode=="TTO"
(46 real changes made)

. replace CID=    788     if countrycode=="TUN"
(20 real changes made)

. replace CID=    792     if countrycode=="TUR"
(36 real changes made)

. replace CID=    795     if countrycode=="TKM"
(46 real changes made)

. replace CID=    796     if countrycode=="TCA"
(48 real changes made)

. replace CID=    798     if countrycode=="TUV"
(24 real changes made)

. replace CID=    800     if countrycode=="UGA"
(36 real changes made)

. replace CID=    804     if countrycode=="UKR"
(56 real changes made)

. replace CID=    784     if countrycode=="ARE"
(20 real changes made)

. replace CID=    826     if countrycode=="GBR"
(0 real changes made)

. replace CID=    581     if countrycode=="UMI"
(0 real changes made)

. replace CID=    840     if countrycode=="USA"
(62 real changes made)

. replace CID=    858     if countrycode=="URY"
(62 real changes made)

. replace CID=    860     if countrycode=="UZB"
(52 real changes made)

. replace CID=    548     if countrycode=="VUT"
(4 real changes made)

. replace CID=    862     if countrycode=="VEN"
(62 real changes made)

. replace CID=    704     if countrycode=="VNM"
(22 real changes made)

. replace CID=    850     if countrycode=="VIR"
(32 real changes made)

. replace CID=    876     if countrycode=="WLF"
(0 real changes made)

. replace CID=    732     if countrycode=="ESH"
(0 real changes made)

. replace CID=    887     if countrycode=="YEM"
(20 real changes made)

. replace CID=    894     if countrycode=="ZMB"
(32 real changes made)

. replace CID=    716     if countrycode=="ZWE"
(22 real changes made)

. 
. 
end of do-file

. tab nation if CID==.

                                Country |      Freq.     Percent        Cum.
----------------------------------------+-----------------------------------
                                Curaçao |         14        5.30        5.30
                    Iraq (Central Iraq) |         22        8.33       13.64
                Iraq (Kurdistan Region) |         12        4.55       18.18
                Kosovo under UNSCR 1244 |         28       10.61       28.79
     United Kingdom (England and Wales) |         63       23.86       52.65
      United Kingdom (Northern Ireland) |         61       23.11       75.76
              United Kingdom (Scotland) |         64       24.24      100.00
----------------------------------------+-----------------------------------
                                  Total |        264      100.00

. 
. gen TEMP=. 
(8,498 missing values generated)

. replace TEMP=0 if CID!=. 
(8,230 real changes made)

. replace TEMP=1 if countrycode=="GBR_E_W"
(63 real changes made)

. replace TEMP=1 if countrycode=="GBR_NI"
(61 real changes made)

. replace TEMP=1 if countrycode=="GBR_S"
(64 real changes made)

. drop if TEMP==. 
(80 observations deleted)

. 
. preserve 

. drop if TEMP==1 
(188 observations deleted)

. drop if unitofmeasurement!="Rate per 100,000 population"
(4,115 observations deleted)

. rename value rhom_un 

. save X-UNODC.dta, replace 
file X-UNODC.dta saved

. restore 

. preserve 

. drop if TEMP==0
(8,230 observations deleted)

. drop if unitofmeasurement=="Rate per 100,000 population"
(93 observations deleted)

. rename value UKhom_un 

. collapse (sum) UKhom_un (firstnm) region subregion source, by(year)

. gen CID=826

. gen countrycode="GBR" 

. save UK-UNODC.dta, replace 
file UK-UNODC.dta saved

. restore 

. 
. //      #4
. // Homicide Data
. use CT00-PridemoreMerge, clear 

. 
. 
. //      #4
. //      Merging data 
. merge  1:1 CID year using X-UNODC.dta
(variable countrycode was str3, now str12 to accommodate using data's values)

    Result                      Number of obs
    -----------------------------------------
    Not matched                        16,716
        from master                    16,564  (_merge==1)
        from using                        152  (_merge==2)

    Matched                             3,963  (_merge==3)
    -----------------------------------------

. drop _merge 

. merge  1:1 CID year using UK-UNODC.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                        20,648
        from master                    20,647  (_merge==1)
        from using                          1  (_merge==2)

    Matched                                32  (_merge==3)
    -----------------------------------------

. drop _merge 

. 
. merge 1:1 CID year using 00-Fraser.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                        17,244
        from master                    17,222  (_merge==1)
        from using                         22  (_merge==2)

    Matched                             3,458  (_merge==3)
    -----------------------------------------

. drop _merge 

. merge 1:1 CID year using SP00-PridemoreMerge.dta
(variable year was int, now double to accommodate using data's values)

    Result                      Number of obs
    -----------------------------------------
    Not matched                         5,262
        from master                     4,930  (_merge==1)
        from using                        332  (_merge==2)

    Matched                            15,772  (_merge==3)
    -----------------------------------------

. drop _merge 

. merge 1:1 CID year using SPOECD.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                        22,668
        from master                    21,034  (_merge==1)
        from using                      1,634  (_merge==2)

    Matched                                 0  (_merge==3)
    -----------------------------------------

. drop  _merge 

. merge 1:1 CID year using KOFGI.dta

    Result                      Number of obs
    -----------------------------------------
    Not matched                        12,320
        from master                    12,320  (_merge==1)
        from using                          0  (_merge==2)

    Matched                            10,348  (_merge==3)
    -----------------------------------------

. drop _merge 

. 
. //      #5
. //      Cleaning up 
. replace rhom_un=UKhom_un/pop*100000 if CID==826 & rhom_un==. 
(31 real changes made)

. 
. gen HOM=. 
(22,668 missing values generated)

. gen MARKET=.
(22,668 missing values generated)

. gen GLOBAL=.
(22,668 missing values generated)

. 
. order  CID nation year regioncode regionname countrycode  region subregion ///
>                  region_un region_un_sub region_wb eu oecd incomegroup ///
>         HOM  rhom rhom_un rfhom rmhom rhom1519 rhom2024 rhom2529 rhom3034 ///
>                 rhom3539 rhom4044 rhom4549 rhom5054 rhom5559 rhom6064 rhom7074
>  ///
>         MARKET  fraser heritage rol ///
>         GLOBAL  KOFGI KOFGIdf KOFGIdj KOFEcGI KOFEcGIdf KOFEcGIdj ///
>                 KOFTrGI KOFTrGIdf KOFTrGIdj KOFFiGI KOFFiGIdf KOFFiGIdj ///
>                 KOFSoGI KOFSoGIdf KOFSoGIdj KOFIpGI KOFIpGIdf KOFIpGIdj ///
>                 KOFInGI KOFInGIdf KOFInGIdj KOFCuGI KOFCuGIdf KOFCuGIdj ///
>                 KOFPoGI KOFPoGIdf KOFPoGIdj ///
>         PROTECT remit private_sp public_sp edu_exp healthexpend hdi ///
>          POLITIC cont_corrupt gov_eff pol_stab regulatory ruleoflaw voice_acco
> unt, first 

. 
. //      #6       
. //      save and close 
. save `file'.dta, replace 
file MAR01-DataClean-UNODC.dta saved

. saveold `file'-old.dta, replace v(11)
(saving in Stata 12 format, which Stata 11 can read)
file MAR01-DataClean-UNODC-old.dta saved

. log close 
      name:  <unnamed>
       log:  /Volumes/rdss_meghrogers/Current Research/Markets-Pridemore/Work/MA
> R01-DataClean-UNODC.log
  log type:  text
 closed on:   5 May 2025, 13:50:39
--------------------------------------------------------------------------------
